package NG::Chat::Client::Handler;
use strict;
use warnings;
use utf8;

sub new {
    my $class = shift;
	my $client = shift;;
    my $self = bless {
		client => $client,
		}, $class;
	unless($client->can("send_message")){
		die "bad client(".ref($client)."), cannot send_message";
	}
	$client->responser($self->process_handler);
    return $self;
}
sub cleanup {
	my $self = shift;
	delete $self->{client};
}
sub process_handler {
	my $self = shift;
	my $sub = $self->can("process_response") || $self->make_process_response;
	unless($sub){
		die "cannot 'process_response'";
	}
	return $sub;
}
1;
